home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada,comp.lang.c++
- Path: news.bton.ac.uk!je
- From: je@bton.ac.uk (John English)
- Subject: Re: on OO differnces between Ada95 and C++
- Message-ID: <Dn4J2F.uI@bton.ac.uk>
- Followup-To: comp.lang.ada,comp.lang.c++
- Organization: University of Brighton, UK
- X-Newsreader: TIN [version 1.2 PL2]
- References: <4gbq7q$g08@qualcomm.com>
- Date: Wed, 21 Feb 1996 11:39:51 GMT
-
- Nasser Abbasi (nabbasi@qualcomm.com) wrote:
- : Lets also assume that we need to define a Money Type, defined in
- : the base class Account.
-
- : In Ada95 this type is defined in the package Account.ads that also
- : includes the definition of the tagged record type Account (along with
- : operations that act on Account type).
-
- : Now, In Ada95, a client that wishes to use Saving_Account type (and
- : any operations on it) will "with" the Saving_Account Package.
-
- If the spec of Saving_Account has "with Account" at the beginning,
- "with Saving_Account" will imply "with Account". Or use child
- packages: make Saving_Account a child of Account (e.g. Account.Saving)
- so that it is effectively an extension of Account.
-
- : In C++, the client to the saving_account class can also use the
- : Money_Type type (even though that is defined in
- : the base class Account) without having to include base class
- : "account.h", this is because Money_Type has become a public part of the
- : Saving_Account class when Saving_Account inherited Saving class.
-
- You can always put "subtype Money_Type is Account.Money_Type" in
- Saving_Account to make it directly usable from Saving_Account...
-
- --
- ----------------------------------------------------------------------------
- John English <je@brighton.ac.uk>, Dept. of Computing, University of Brighton
- "Disks are divided into sex and tractors..."
- ----------------------------------------------------------------------------
-